﻿using Client.BaseModule;
using Client.BLL;
using Client.DAL;
using Client.IBLL;
using Client.IDAL;
using Client.MainModule;
using Client.Start.Views;
using Prism.Ioc;
using Prism.Modularity;
using Prism.Unity;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

 

namespace Client.Start {
  /// <summary>
  /// Interaction logic for App.xaml
  /// </summary>
  public partial class App : PrismApplication {
    protected override Window CreateShell() {
      return Container.Resolve<MainView>();
    }
    protected override void InitializeShell(Window shell) {
      //先打开登录窗口，如果登录成功，则打开主窗口
      if (Container.Resolve<LoginView>().ShowDialog() == false) {
        Application.Current?.Shutdown();
      } else {
        base.InitializeShell(shell);
      }
    }
    protected override void RegisterTypes(IContainerRegistry containerRegistry) {
      containerRegistry.Register<ILoginDAL,LoginDAL>();
      containerRegistry.Register<ILoginBLL, LoginBLL>();
    }
    protected override void ConfigureModuleCatalog(IModuleCatalog moduleCatalog) {
      //可以改为自动扫描
      moduleCatalog.AddModule<MainModule.MainModule>();
      moduleCatalog.AddModule<BaseInfoModule>();
    }
  }
}
